package com.tailyou.hms.firstapp.test

import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.tailyou.hms.firstapp.R
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject

class TestActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_tab_layout)
        val jsonStr = "{\n" +
                "            \"hobbies\":[\"football\",\"reading\"]\n" +
                "        }"
        try {
            val jsonObject = JSONObject(jsonStr)
            val jsonArray = jsonObject.getJSONArray("hobbies")
            var ja = JSONArray();
            ja.put("readding")
            Log.d("TAG", jsonArray.getString(1))
        } catch (e: JSONException) {
            throw RuntimeException(e)
        }
    }
}